//
//  XCCycleDelegate.swift
//  XCCycleBanner
//
//  Created by edy on 2023/7/10.
//

import Foundation


public protocol XCCycleDelegate: AnyObject {
    
    /// 点击
    func xcBanner(banner: XCCycleType,
                  didSelectItemAt index: Int)
    
    /**
     即将显示的索引
     */
    func xcBanner(banner: XCCycleType,
                  center index: Int)
    
    /**
     即将显示的Cell
     */
    func xcBanner(banner: XCCycleType,
                  centerIndex: Int,
                  centerCell: UICollectionViewCell)
    
    
    /**
     即将消失的Cell
     */
    func xcBanner(banner: XCCycleType,
                  lastCenterIndex: Int?,
                  lastCenterCell: UICollectionViewCell?)
    
}


/// The default implementation
public extension XCCycleDelegate {
    
    func xcBanner(banner: XCCycleType,
                  didSelectItemAt index: Int) {
        print(" #####您选择了 item >>> \(index) <<<<")
    }

    func xcBanner(banner: XCCycleType,
                  center index: Int) {
        print(" #####即将展示 item >>> \(index) <<<<")
    }

    func xcBanner(banner: XCCycleType,
                  centerIndex: Int,
                  centerCell: UICollectionViewCell) {
        print(" #####即将展示 centerCell >>> \(centerCell) <<<<")
    }
    
    func xcBanner(banner: XCCycleType,
                  lastCenterIndex: Int?,
                  lastCenterCell: UICollectionViewCell?) {
        print(" #####即将消失的Cell centerCell >>> \(lastCenterCell) <<<<")
    }
}
